package org.bbs.demo.topic.dao;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.bbs.demo.topic.model.Topic;

import java.util.ArrayList;

@Mapper
public interface ShowTopicListDao {
    //topic_id(picture),session_id,topic,user_id,replays,text,t_time,t_click,t_likes,

    /**@Select("select * from bbstopic LEFT OUTER JOIN picture on bbstopic.topic_id where bbstopic.topic_id LIKE #{topic_id}")
    public ArrayList<Topic> findTopic(String topic_id);**/

    @Select("select * from bbstopic where topic_id LIKE #{topic_id}")
    public Topic findTopic(String topic_id);

    @Select("select picture_addr from picture where topic_id LIKE #{topic_id}")
    public ArrayList<String> findPicture(String topic_id);

    @Update("update bbstopic set t_clik = t_clik + 1 where topic_id = #{topic_id}")
    public int addClik(String topic_id);

    //点击，热度+1
    @Update("update bbstopic set sexy = sexy + 1 where topic_id = #{topic_id}")
    public int cliksSexy(String topic_id);
}
